//导入request.js请求工具
import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token.js';

export const findCourse = (categoryData)=>{
    return request.post('/index/findCourse?currentPage='+categoryData.currentPage,categoryData)
}

export const addCourseEnrollment = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/addCourseEnrollment',categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const findCourseEnrollment = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/findCourseEnrollment?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const findGrowthRecord = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/findGrowthRecord?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}


export const findProduct = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/findProduct?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const addOrders = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/addOrders?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}


export const findOrders = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/findOrders?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const addProductReview = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/addProductReview?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const getUserDate = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/getUserDate?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}


export const getStuDate = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/getStuDate?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const updateUser = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/updateUser?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const updateStu = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/updateStu?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const addStu = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/addStu?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const delStu = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/delStu?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}

export const findCommunityPost = (categoryData)=>{
    const tokenStore = useTokenStore()
    return request.post('/index/findCommunityPost?currentPage='+categoryData.currentPage,categoryData,{headers:{'Authorization':tokenStore.token}})
}




export const finUserData = (categoryData)=>{
    
    const tokenStore = useTokenStore();
    console.log(tokenStore.token);
    tokenStore.token;
    return request.post('/index/finUserData',{headers:{'Authorization':tokenStore.token}})
}





